package org.linlinjava.litemall.db.dao;

import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Select;
import org.linlinjava.litemall.db.domain.LumiereCouponUser;
import org.linlinjava.litemall.db.dto.WxCountUserCouponsDTO;

import java.util.List;

public interface LumiereCouponUserMapper extends MPJBaseMapper<LumiereCouponUser> {

    @Select("SELECT COUNT(*) AS count,strategy_id,coupon_id FROM lumiere_coupon_user WHERE user_id = #{userId} GROUP BY coupon_id ORDER BY add_time desc")
    List<WxCountUserCouponsDTO> countUserCoupons(Integer userId);
}
